<template>
  <div>
    <div class="coin-content">
      <div class="icon coin" v-if="icon === 'coin'"></div>
      <div class="icon diamond" v-if="icon === 'diamond'"></div>
      <div class="val">11,095</div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps(['icon'])
</script>

<style lang="scss" scoped>
.coin-content {
  height: 4.4rem;
  width: 12.2rem;
  display: flex;
  align-items: center;

  .icon {
    height: 4.4rem;
    position: relative;
    z-index: 3;
    flex: 0 0 4.4rem;

    &.coin {
      background: url('/src/assets/icon/icon_jinbi.png');
      background-size: 100% auto;
      background-repeat: no-repeat;
    }
    &.diamond {
      background: url('/src/assets/icon/icon_zuanshi.png');
      background-size: 100% auto;
      background-repeat: no-repeat;
    }
  }
  
  .val {
    flex: 1;
    height: 2.8rem;
    background: linear-gradient(180deg, #fef8d3 20%, #f9df7a 80%); // 渐变色方向可自定义
    -webkit-background-clip: text; // 关键：将背景裁剪为文字形状
    -webkit-text-fill-color: transparent; // 文字填充颜色设为透明以显示背景
    font-size: 2rem;
    line-height: 2.8rem;
    text-align: center;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-left: -2rem;
    position: relative;

    &::after {
      position: absolute;
      content: "";
      background: linear-gradient(180deg, rgba(0,0,0,0.2), rgba(0,0,0,0.4));;
      border-radius: 0 2.8rem 2.8rem 0;
      left: 0;
      top: 0;
      height: 2.8rem;
      width: 100%;
      z-index: -2;
    }
  }
}
</style>